#pragma once

#include "IndexBuffer.h"
#include "ShaderProgram.h"
#include "VertexArray.h"
#include "VertexBuffer.h"
#include <assimp/types.h>
#include <string>
#include <vector>
#include <glm/glm.hpp>

struct OpenGLVertex {
    glm::vec3 position;  // 位置向量
    glm::vec3 normal;    // 法向量
    glm::vec2 texCoords; // 纹理坐标
};

struct OpenGLTexture {
    unsigned int id;
    std::string  type;
    aiString     path;
};

class Mesh {
public:
    Mesh(std::vector<OpenGLVertex> vertices, std::vector<unsigned int> indices, std::vector<OpenGLTexture> textures);
    ~Mesh();

public:
    void draw(ShaderProgram &program);

private:
    void setupMesh();

private:
    std::vector<OpenGLVertex>  m_vertices;
    std::vector<unsigned int>  m_indices;
    std::vector<OpenGLTexture> m_textures;

    VertexArray  *m_vao;
    VertexBuffer *m_vbo;
    IndexBuffer  *m_ebo;
};